package it.luigiarpino.sudoku;

import javax.swing.*;

public class GUI extends JFrame {
    

	private static final long serialVersionUID = 1L;
		private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenu jMenu_File;
        private javax.swing.JMenuItem jMenuExit;
        private javax.swing.JMenu jMenuGame;
        private javax.swing.JMenuItem jMenuNewGame;
        private javax.swing.JMenu jMenuHelp;
        private javax.swing.JMenuItem jMenu_About;
        private javax.swing.JPanel Pannello;
 
    /** Creates new form GUI */
    public GUI() {
    	// imposta il Look&Feel di sistema 
    	try 
    	{ 
      		javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName()); 
                
    	} 
    	catch(Exception e) {}
        Pannello=new javax.swing.JPanel();
        jMenuBar1= new javax.swing.JMenuBar();
        jMenu_File= new javax.swing.JMenu();
        jMenuExit= new javax.swing.JMenuItem();
        jMenuGame = new javax.swing.JMenu();
        jMenuNewGame= new javax.swing.JMenuItem();
        jMenuHelp= new javax.swing.JMenu();
        jMenu_About= new javax.swing.JMenuItem();
        Components();
        setSize(400,400);
        //Controllo Licenza
        /*
        Autenticazione aut=new Autenticazione();
        if (aut.IsRegistrato()){
            javax.swing.JOptionPane.showMessageDialog(null,aut.getDati(),"Sudoku",javax.swing.JOptionPane.INFORMATION_MESSAGE);
        }
        else{
            String messaggio;
            messaggio="<HTML><BODY><P>Questo programma � in versione dimostrativa </P>" +
            "<P>Pertanto verr&agrave visualizzato sempre lo stesso schema Sudoku</P>" +
            "<P>Per sbloccare il programma contattare <A href='skys.net@libero.it'>Skys.Net@Libero.it</A>  </P>" +
            "<P>Buon Divertimento Luigi.</P> </BODY> </HTML>";
            javax.swing.JOptionPane.showMessageDialog(null,messaggio,"Sudoku",javax.swing.JOptionPane.INFORMATION_MESSAGE);
        }
        */
        this.setResizable(false);
        
    }
    


    private void Components() {

        setTitle("Sudoku - By Luigi Arpino");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

        jMenu_File.setText("File");
        jMenu_File.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu_FileActionPerformed(evt);
            }
        });

        jMenuExit.setText("Exit");
        jMenuExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu_EsciActionPerformed(evt);
            }
        });

        jMenu_File.add(jMenuExit);

        jMenuBar1.add(jMenu_File);

        jMenuGame.setText("Game");
        jMenuGame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu_GiocaActionPerformed(evt);
            }
        });

        jMenuNewGame.setText("New Game");
        jMenuNewGame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu_Genera_SchemaActionPerformed(evt);
            }
        });

        jMenuGame.add(jMenuNewGame);

        jMenuBar1.add(jMenuGame);

        jMenuHelp.setText("Help");
        jMenu_About.setText("About");
        jMenu_About.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu_AboutActionPerformed(evt);
            }
        });

        jMenuHelp.add(jMenu_About);

        jMenuBar1.add(jMenuHelp);

        setJMenuBar(jMenuBar1);
        this.getContentPane().add(Pannello);

        pack();
    }

    private void jMenu_GiocaActionPerformed(java.awt.event.ActionEvent evt) 
    {
    }

    private void jMenu_Genera_SchemaActionPerformed(java.awt.event.ActionEvent evt) 
    {
        GuiScegliDifficolta schema=new GuiScegliDifficolta(this, true);
        schema.setLocationRelativeTo(null);
        schema.setVisible(true);
    }

    private void jMenu_EsciActionPerformed(java.awt.event.ActionEvent evt) 
    {
        System.exit(1);
    }

    private void jMenu_AboutActionPerformed(java.awt.event.ActionEvent evt) 
    {
        String messaggio="<HTML><BODY>"+
        	"<P>This is a simple sudoku generator and player.</P>"+
        	"<P>Sudoku is a japanese logic puzzle.</P><BR><BR>"+
        	
        	"<P>This is free software; you can redistribute it and/or modify it under the terms <BR>"+
        	"of the GNU General Public License version 3 as published by the Free Software Foundation;</P><BR><BR>"+
        	
        	"<P>This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;<BR>"+
        	"without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<BR>"+
        	"See the GNU General Public License for more details.</P><BR><BR>"+
        	
        	"<P> Written by Luigi Arpino <A href='luigiarpino@yahoo.it'>luigiarpino@yahoo.it</A> </P>" +
            "</BODY> </HTML>";
        JOptionPane.showMessageDialog(this, messaggio, "About", JOptionPane.INFORMATION_MESSAGE);
    }

    private void jMenu_FileActionPerformed(java.awt.event.ActionEvent evt) 
    {
    
    }
    
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        System.exit(0);
    }//GEN-LAST:event_exitForm
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[])
    {
        GUI gui = new GUI();
        gui.setLocationRelativeTo(null);
        gui.setVisible(true);
    }
    
    
}
